﻿Module Primary
    Public WithEvents Engine As Arps.Engine
    Public MainFormReference As frmMain
    Public ShadowsListForm As frmShadowList

    Public Sub Engine_FacilityChanged(ByVal text As String) Handles Engine.LogChanged
        MainFormReference.lstEngineLog.Items.Add("[ENGINE] " & text)
        If (MainFormReference.lstEngineLog.SelectedIndex > -1) Then MainFormReference.lstEngineLog.SetSelected(MainFormReference.lstEngineLog.SelectedIndex, False)
        MainFormReference.lstEngineLog.SetSelected(MainFormReference.lstEngineLog.Items.Count - 1, True)
        MainFormReference.lstEngineLog.Refresh()
    End Sub

    Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer
    Friend Sub SuspendPaint(ByVal targetControl As Windows.Forms.Control)
        SendMessage(targetControl.Handle, 11, 0, 0)
    End Sub
    Friend Sub ResumePaint(ByVal targetControl As Windows.Forms.Control, ByVal redraw As Boolean)
        SendMessage(targetControl.Handle, 11, 1, 0)
        If redraw Then targetControl.Refresh()
    End Sub
End Module
